package kr.pe.johnkim.waiting.mobile.controller;

import kr.pe.johnkim.waiting.mobile.domain.WaitingBusinessKind;
import kr.pe.johnkim.waiting.mobile.service.WaitingBusinessKindService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 업종 관련 controller class 이다.
 * 현재는 마일리지 서비스에서 사용중인 CHECKMILEAGE_BUSINESS_KINDS 테이블을 공유중이다.
 *
 * @author : John_Kim <cale9797@gmail.com>
 * @date : 13. 8. 29.
 */
@Controller
@RequestMapping(value = "/waitingBusinessKindController")
public class WaitingBusinessKindController {

    // SLF4J Logging
    private Logger logger = LoggerFactory.getLogger(WaitingBusinessKindController.class);

    @Autowired
    private WaitingBusinessKindService waitingBusinessKindService;

    /**
     * 업종 목록을 가져 온다.
     *
     * @param waitingBusinessKind : WaitingBusinessKind
     * @return : List<WaitingBusinessKind>
     * @throws Exception
     */
    @RequestMapping(value = "/selectBusinessKindList", method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.OK)
    @ResponseBody
    public List<WaitingBusinessKind> selectBusinessKindList(@RequestBody WaitingBusinessKind waitingBusinessKind) throws Exception {
        logger.info("selectBusinessKindList");

        logger.info("> countryCode : {}", waitingBusinessKind.getCountryCode());
        logger.info("> activateYn  : {}", waitingBusinessKind.getActivateYn());

        return this.waitingBusinessKindService.selectBusinessKindList(waitingBusinessKind);
    }
}
